package com.hotline.communication.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum ScenarioTypeEnum {

    ON_HOOK(0,"挂机"),
    TRANSFER_TO_EXTERNAL_LINE(1,"转外线"),
    TRANSFER_TO_LABOR(2,"转人工"),
    MAIN_MENU(3,"主菜单"),
    LEAVE_MESSAGE(4,"留言"),
    TRANSFER_MANUAL_TIMEOUT(5,"转人工超时"),
    TRANSFER_SATISFACTION(6,"转满意度"),
    TRANSFER_TO_EXTERNAL_AI(7,"转外线智能"),
    PLAY_PROMPT_TONE_WITHOUT_INTERRUPTION(10,"不打断放提示音"),
    INTERRUPT_AND_PLAY_PROMPT_TONE(11,"打断放提示音"),
    RECEIVE_ONE(12,"放音收一位号"),
    UNIFIED_REGION_SELECTION(94, "区域重新选择"),
    REGION_SELECTION(96,"区域选择"),
    WELCOMING_SPEECH(97,"欢迎词"),
    IVR_OUTPUT(98,"出IVR"),
    ENTER_IVR(99,"进IVR");

    /**
     * 编码
     */
    private Integer code;

    /**
     * 名称
     */
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    ScenarioTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ScenarioTypeEnum getScenarioTypeEnum(Integer code){
        for (ScenarioTypeEnum backlogTypeEnum : ScenarioTypeEnum.values()){
            if(backlogTypeEnum.getCode().equals(code)){
                return backlogTypeEnum;
            }
        }
        return null;
    }

    public static List getScenarioTypeEnumList(){
        List list = new ArrayList();
        for (ScenarioTypeEnum backlogTypeEnum : ScenarioTypeEnum.values()){
            Map map = new HashMap<>();
            map.put("code",backlogTypeEnum.getCode());
            map.put("name",backlogTypeEnum.getName());
            list.add(map);
        }
        return list;
    }
}
